﻿using Grow.EventBus.Cap.SubscriberHandler;
using Grow.Module.Service;
using Grow.Scheduler.Job;

namespace Grow.EventBus.Cap.Job
{
    public class DelaySubscriberJob : JobBase<SubscriberEventDataDto>
    {
        private readonly ISubscriberHandler _subscriberHandler;
        public DelaySubscriberJob(IServiceContext serviceContext) : base(serviceContext)
        {
            _subscriberHandler = serviceContext.GetRequiredService<ISubscriberHandler>();
        }

        public override async Task ExecuteAsync(SubscriberEventDataDto jobData, CancellationToken cancellationToken)
        {
            await _subscriberHandler.ExecuteAsync(jobData, cancellationToken);
        }
    }
}
